<template>
	<view class="agent-info-layout">
		<view class="agent-info-header" @tap="showBaseInfo">
			<image src="/static/operate/agent_photo.png" mode="scaleToFill"></image>
			<view class="agent-info-header-content">
				<text class="agent-info-header-content-name">{{dataInfo.agentName}}</text>
				<text>编号：{{dataInfo.agentId}}</text>
				<text>手机号：{{dataInfo.tel}}</text>
				
			</view>
			<xh-icon icon="icon_jiantou" color="#ffffff" style="margin-left: auto;"></xh-icon>
		</view>
		<!-- 产品政策/机具管理 -->
		<view class="agent-info-grid">
			<view class="agent-info-grid-item" @tap="showProductPolicy">
				<image src="/static/home/agentInfo_cpzc.png" mode="aspectFit"></image>
				<text>产品政策</text>
			</view>
			<view class="agent-info-grid-item" @tap="showDeviceManager">
				<image src="/static/home/agentInfo_jjgl.png" mode="aspectFit"></image>
				<text>机具管理</text>
			</view>
		</view>
		<!-- 运营报表/货款账单/考核账单 -->
		<view class="agent-info-list">
			<view class="agent-info-list-item" @tap="showReport">
				<image src="/static/home/agentinfo_yybb.png" mode="aspectFit"></image>
				<text>运营报表</text>
				<xh-icon icon="icon_jiantou" style="margin-left: auto;"></xh-icon>
			</view>
			<view class="agent-info-list-item" @tap="showPaymentBill('货款')">
				<image src="/static/home/agentinfo_hkzd.png" mode="aspectFit"></image>
				<text>货款账单</text>
				<xh-icon icon="icon_jiantou" style="margin-left: auto;"></xh-icon>
			</view>
			<view class="agent-info-list-item" @tap="showPaymentBill('考核')">
				<image src="/static/home/agentinfo_hkzd.png" mode="aspectFit"></image>
				<text>考核账单</text>
				<xh-icon icon="icon_jiantou" style="margin-left: auto;"></xh-icon>
			</view>
		</view>
		<view style="padding: 30rpx 0;font-size: 30rpx;font-weight: 500;">货款管理</view>
		<!-- 货款管理 -->
		<view class="agent-info-hk-list">
			<view class="agent-info-hk-list-item" @tap="didSelectItem(1)">
				<image src="/static/home/agentinfo_cjzd.png" mode="aspectFit"></image>
				<text>创建订单</text>
				<xh-icon icon="icon_jiantou" style="margin-left: auto;"></xh-icon>
				<view class="line"></view>
			</view>
			<view class="agent-info-hk-list-item" @tap="didSelectItem(2)">
				<image src="/static/home/agentinfo_dkpz.png" mode="aspectFit"></image>
				<text>抵扣配置</text>
				<xh-icon icon="icon_jiantou" style="margin-left: auto;"></xh-icon>
				<view class="line"></view>
			</view>
			<view class="agent-info-hk-list-item" @tap="didSelectItem(3)">
				<image src="/static/home/agentinfo_hkkh.png" mode="aspectFit"></image>
				<text>货款核销</text>
				<xh-icon icon="icon_jiantou" style="margin-left: auto;"></xh-icon>
				<view class="line"></view>
			</view>
		</view>
	</view>
</template>

<script setup>
	const props = defineProps(['data'])
	const dataInfo = JSON.parse(decodeURIComponent(props.data || '{}'))
	console.log(dataInfo)
	// 代理商基本信息
	const showBaseInfo = ()=>{
		uni.navigateTo({
			url:`/pages/home/agent-manager/agent-info/agent-base-info/agent-base-info?data=${props.data}`
		})
	}
	// 产品政策
	const showProductPolicy = ()=>{
		uni.navigateTo({
			url:`/pages/home/agent-manager/agent-info/policy-list/policy-list?data=${props.data}`
		})
	}
	// 机具管理
	const showDeviceManager = ()=>{
		uni.navigateTo({
			url:`/pages/home/device-manager/device-list/device-list?agentId=${dataInfo.agentId}`
		})
	}
	// 运营报表
	const showReport = ()=>{
		uni.navigateTo({
			url:`/pages/home/agent-report/agent-report?agentId=${dataInfo.agentId}`
		})
	}
	// 货款/考核账单
	const showPaymentBill = (type)=>{
		uni.navigateTo({
			url:`/pages/home/agent-manager/agent-info/payment-bill/payment-bill?type=${type}&agentId=${dataInfo.agentId}`
		})
	}
	// 选择创建订单/抵扣配置/货款核销
	const didSelectItem = (type)=>{
		if(type == 1){
			uni.navigateTo({
				url:`/pages/home/agent-manager/agent-info/create-payment-bill/create-payment-bill?agentId=${dataInfo.agentId}`
			})
		}
		if(type == 2){
			uni.navigateTo({
				url:`/pages/home/agent-manager/agent-info/deduction-config/deduction-config?agentId=${dataInfo.agentId}`
			})
		}
		if(type == 3){
			uni.navigateTo({
				url:`/pages/home/agent-manager/agent-info/payment-cancellation/payment-cancellation?agentId=${dataInfo.agentId}`
			})
		}
	}
</script>

<style lang="scss" scoped>
.agent-info-layout{
	padding: 30rpx;
	.agent-info-header{
		background-image: url('/static/operate/yy_byjy_bg@2x.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		display: flex;
		align-items: center;
		padding: 30rpx;
		.agent-info-header-content{
			color: #fff;
			display: flex;
			flex-direction: column;
			margin-left: 20rpx;
			font-size: 26rpx;
			text:nth-child(1){
				font-size: 28rpx;
			}
			text:nth-child(2){
				margin: 10rpx 0;
			}
		}
		image{
			width: 128rpx;
			height: 128rpx;
		}
	}
	.agent-info-grid{
		display: grid;
		grid-template-columns: repeat(2,1fr);
		gap: 20rpx;
		padding: 30rpx 0;
		.agent-info-grid-item{
			display: flex;
			align-items: center;
			border: 1px solid #eee;
			border-radius: 12rpx;
			padding: 20rpx 30rpx;
			background-color: #fff;
			image{
				width: 80rpx;
				height: 80rpx;
			}
			text{
				margin-left: 40rpx;
			}
			&:nth-child(2){
				margin-left: 20rpx;
			}
		}
	}
	.agent-info-list{
		display: grid;
		grid-gap: 20rpx;
		.agent-info-list-item{
			background-color: #fff;
			border: 1px solid #eee;
			border-radius: 12rpx;
			padding: 20rpx 30rpx;
			display: flex;
			align-items: center;
			text{
				margin-left: 10rpx;
			}
			image{
				width: 48rpx;
				height: 48rpx;
			}
		}
	}
	.agent-info-hk-list{
		background-color: #fff;
		border-radius: 20rpx;
		.agent-info-hk-list-item{
			display: flex;
			align-items: center;
			padding: 20rpx 30rpx;
			position: relative;
			image{
				width: 48rpx;
				height: 48rpx;
			}
			text{
				margin-left: 10rpx;
			}
		}
		
	}
}
</style>
